Answer 1
;1=Use TLS on POP3 Connect
pop3.SetSSL(1)
;Connecting to Server
$ConnectStatus = pop3.Connect($ServerName, $Port)
If $ConnectStatus <> 1
Display "Connection Failed.."
Log "Connection Failed " $error
Hangup
Goto Main
Endif
;Login to Server
$LoginStatus = pop3.Login($Username,$Password)
If $LoginStatus <> 1
Display "Login Failed.."
Log "Login Failed " $error
Hangup
Goto Main
Endif
;Fetch the First mail [ Unread ] Mail from Server
$FetchMailStatus = pop3.FetchMail(1)
If $FetchMailStatus <> 1
Display " Fetch Mail Failed.."
Log "Fetch Mail Failed " $error
Hangup
Goto Main
Endif
;Get data of fetched mail from server
$GetMaildata = pop3.GetMail()
If $GetMaildata = ""
Display "Failed to get mail"
Log "Failed to get mail"
Hangup
Goto Main
Endif
;Raw Data
Display "Mail Data " $GetMaildata
Log "Mail Data " $GetMaildata
;Delete mail
$Status = pop3.DeleteMail(1)
If $Status <> 1
Display "DeleteMail Failed.."
Log "DeleteMail Failed " $error
Hangup
Goto Main
Endif
;Closing Connection
Display "Closing connection..."
pop3.Close()
Hangup
Goto MAIN
* User has hung up
ONHANGUP: